#include <vector>
using namespace std;
class Solution {
public:
    void FindNumsAppearOnce(vector<int> data,int* num1,int *num2) 
    {
    	if(data.size() < 2)
    		return;
		int a,b;
		//a用作sum，记录所有值的异或
		int length = data.size();
		a = data[0];
		for(int i = 1; i != length ; ++i)
		{
			a^=data[i];
		}
		//b用作index，记录第一个为1的位
		b = 1;
		while((a & 1) == 0)
		{
			a>>=1;
			b<<=1;
		}
		//分割数组为两个子数组，每个子数组包含一个仅出现一次的数
		int data1[length],data2[length];
		int length1 = 0,length2 = 0;
		for(int i = 0 ; i != length ; ++i)
		{
			if((data[i] & b) == 0)
				data1[length1++] = data[i];
			else
				data2[length2++] = data[i];
		}
		if(length1>0)
		{
			a = data1[0];
			for(int i = 1 ; i != length1; ++i)
			{
				a^=data1[i];
			}
		}
		if(length2>0)
		{
			b = data2[0];
			for(int i = 1 ; i != length2; ++i)
			{
				b ^= data2[i];
			}
		}
		*num1 = a;
		*num2 = b;
	}
};